#!usr/bin/env python


from pywinauto.application import Application


if __name__ == '__main__':
    app = Application(backend='uia').start("D:\\application\JDWorkbench\Com.JD.JR.IM.Workbench.exe", 1)
    own_window = app.window(title=u"京东金融 | 智能客服 | 登录", control_type="Window")
    own_window.wait("visible", 2, 5)
    print(u"找到用户名")
    edit_username = own_window.child_window(auto_id="tb_username", control_type="List")
    print(edit_username.exists())

    edit_password = own_window.child_window(auto_id="passwordBox",
                                                      control_type="Edit")
    print(edit_password.exists())
    # self.driver.find_child_window(self.own_window, auto_id="passwordBox",
    # control_type="Edit")
    # self.ck_remember = self.driver.find_child_window(self.own_window, title=u"记住密码", class_name="checkbox")
    # self.ck_auto_login = self.driver.find_child_window(self.own_window, title=u"自动登录", class_name="checkbox")
    btn_login =own_window.child_window(class_name="Button", found_index=2)
    edit_password.set_text("xinxibu456")
